import logging
import os

def configure_logging():
    

    # 获取当前脚本所在目录
    current_dir = os.path.dirname(os.path.abspath(__file__))
    # 拼接日志文件的绝对路径
    log_file_path = os.path.join(current_dir, "../log/log.log")
    
    # 配置日志
    logging.basicConfig(
        level=logging.INFO,  # 确保日志级别为 INFO
        format="%(asctime)s - %(levelname)s - %(message)s",
        handlers=[
            logging.FileHandler(log_file_path, encoding="utf-8"),
            logging.StreamHandler()  # 添加控制台输出
        ]
    )
    return logging

logging = configure_logging()
logging.info("日志初始化完成")